
// this class is the base for each layer: feature, pattern, cognition
abstract class PLLayer {
	String mName;
	public PLLayer() {}
	
	public PLLayer(String name) {mName = name; }

	String GetName() {return mName;}

	// a layer may be asked to build a response to a query from scratch.
	// returns a new shape as a response and the confidence in this response
	public abstract float BuildResponse(PLShape query, PLOutShape  outResponse);
	
	// given a query, response pair a layer may be asked to validate the response 
	// and possible return a better match if the confidence in the given response is not high
	public abstract float ValidateResponse(PLShape query, PLShape response, PLOutShape  outBetterMatch);				

	// given a query and response the layer generated in the previous call to build(outResponse) or validate response(outBetterMatch),
	// the layer can be asked to improve the response given a better match generated by a higher layer
	// note that the input better match can be null
	public abstract float ImproveResponse(PLShape query, PLOutShape outResponse, PLShape  betterMatch);				
}
